﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RangeValidator1.MaximumValue = System.DateTime.Now.ToString(); 
        }

        protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (args.Value == "admin")
            {
                args.IsValid = false;
            }
            else 
            {
                args.IsValid = true;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            this.Button1 = this.Button1;
            if (Page.IsValid == true)
            {
                Session.Add("name", TextBox1.Text);
                Session.Add("pass", TextBox2.Text);
                Label1.Text = "注册成功" + "   <a href=\"WebForm2.aspx\">去登陆</a>";
            }
        }
    }
}